/****************************************************************************
 * 2025.9 阿桑的笔记本
 ****************************************************************************/

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using QFramework;


using IE.RSB;
namespace QFramework.Example
{
	public partial class WindPlanes : UIElement
	{

        public SurroundingsPlanes surroundingsPlanes;

		private void Awake()
		{
            DataStartSet();


            BtnClicks();

        }

		protected override void OnBeforeDestroy()
		{
		}

        public override void DataStartSet()
        {
            // base.DataStartSet();

            //XWind.text = FreePlayDataManager.Instance.EnvironmentProperties.m_windSpeed.x.ToString();
            //YWind.text = FreePlayDataManager.Instance.EnvironmentProperties.m_windSpeed.y.ToString();
            //ZWind.text = FreePlayDataManager.Instance.EnvironmentProperties.m_windSpeed.z.ToString();

            XWind.text  = surroundingsPlanes.dataManager.GetEnvironmentProperties().m_windSpeed[0].ToString();
            YWind.text = surroundingsPlanes.dataManager.GetEnvironmentProperties().m_windSpeed[1].ToString();
            ZWind.text = surroundingsPlanes.dataManager.GetEnvironmentProperties().m_windSpeed[2].ToString();
        }

        public override void BtnClicks()
        {
            base.BtnClicks();
            WindSetBtn.onClick.AddListener(() =>
            {

                surroundingsPlanes.dataManager.gameScenceDatas.WindSpeedX = float.Parse(XWind.text);
                surroundingsPlanes.dataManager.gameScenceDatas.WindSpeedY = float.Parse(YWind.text);
                surroundingsPlanes.dataManager.gameScenceDatas.WindSpeedZ = float.Parse(ZWind.text);
                //var coifig = DataManager.Instance.EnvironmentProperties;

                //coifig.m_windSpeed = new Vector3(float.Parse(XWind.text),
                //    float.Parse(YWind.text), float.Parse(ZWind.text));
                //Debug.Log("修改后的风向值" + coifig.m_windSpeed);

                //FreePlayDataManager.Instance.gameModel.gameScence.WindSpeedX = float.Parse(XWind.text);

                //FreePlayDataManager.Instance.gameModel.gameScence.WindSpeedY = float.Parse(YWind.text);

                //FreePlayDataManager.Instance.gameModel.gameScence.WindSpeedZ = float.Parse(ZWind.text);

                this.Hide();
            });

            WindQuitBtn.onClick.AddListener(() =>
            {
                //XWind.text = FreePlayDataManager.Instance.gameModel.gameScence.WindSpeedX.ToString();
                //YWind.text = FreePlayDataManager.Instance.gameModel.gameScence.WindSpeedY.ToString();
                //ZWind.text = FreePlayDataManager.Instance.gameModel.gameScence.WindSpeedZ.ToString();

                XWind.text = surroundingsPlanes.dataManager.GetEnvironmentProperties().m_windSpeed[0].ToString();
                YWind.text = surroundingsPlanes.dataManager.GetEnvironmentProperties().m_windSpeed[1].ToString();
                ZWind.text = surroundingsPlanes.dataManager.GetEnvironmentProperties().m_windSpeed[2].ToString();

                this.Hide();
            });
        } 
       
          
            //throw new NotImplementedException();
        
    }
}